class Explosion extends AnimSprite{
  
  Sound sound;
  Explosion():super(Explosion.getAnimSpec())
  {
    sound = new Sound("sfx/explosion.ogg");
  }
  
  void onNewParent()
  {
    super.onNewParent();
    setAnim("explode");
    _repeat = false;
    play(true);
    sound.play();
    
  }
  
  static Object getAnimSpec()
  {
    return {
      'src':'img/explosion.png',
      'frameWidth': 1602/12,
      'frameHeight': 134,
      'explode': [[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11]]
    };
  }
  
  void update(int time)
  {
    if(!isPlaying)
    {
      parent.removeChild(this);
      this.parent = null;
    }
    else
    {
      super.update(time);
    }
  }
}
